package demo3;

public class Test {
    public static void main(String[] args) {
        String str = "abcdavfrasd";
        StringBuilder sb = new StringBuilder();
        sb.append(str.charAt(0));
        for (int i = 0; i < str.length(); i++) {
            String s = sb.toString();
            if (!s.contains(str.charAt(i)+"")) {
                sb.append(str.charAt(i));
            }
        }
        System.out.println(sb.toString());

    }
}
